<#include "/common/head.html"/>
  
 <div class="easyui-panel addPage" data-options="fit:true,border:false,novalidate:true">
    <form class="easyui-form" id="ff" method="post" data-options="novalidate:true">
        <table class="table1">
        	
            <tr>
           		<th><span>商品名称：</span></th>
               	<td>
               		<div class="wrap_input"><input class="easyui-textbox" type="text" name="goodsName"   value="" data-options="fit:true"  disabled="disabled"></input></div>
           		</td>
           	</tr>
            <tr>	
           		<th><span>商品售价：</span></th>
               	<td>
               		<div class="wrap_input"><input class="easyui-textbox" type="text" name="commodityprice" value="" data-options="fit:true" disabled="disabled"></input></div>
           		</td>
            </tr>
             <tr>	
           		<th><span>商品类别：</span></th>
               	<td>
               		<div class="wrap_input"><input class="easyui-textbox" type="text" name="" id="merchandise" value="" data-options="fit:true" disabled="disabled"></input>
               		<input class="easyui-textbox" type="hidden" name="merchandise" value="" data-options="fit:true" disabled="disabled"></input>
               		</div>
           		</td>
            </tr>
              <tr>	
           		<th><span>库存：</span></th>
               	<td>
               		<div class="wrap_input"><input class="easyui-textbox" type="text" name="currentinventory" value="" data-options="fit:true" disabled="disabled"></input></div>
           		</td>
            </tr>
      
               <tr>	
           		<th><span>总需份额：</span></th>
               	<td>
               		<div class="wrap_input"><input class="easyui-textbox" type="text" name="partion" value="" data-options="required:true"></input></div>
           		</td>
              </tr>
               <tr>	
           		<th><span>每份额：</span></th>
               	<td>
               		<div class="wrap_input"><input class="easyui-textbox" type="text" name="perpartion" value="" data-options="required:true"></input></div>
           		</td>
            </tr>
               <tr>	
           		<th><span>方案编号：</span></th>
               	<td>
               		<div class="wrap_input"><input class="easyui-textbox" type="text" name="competitionId" value="" data-options="required:true"></input></div>
           		</td>
            </tr>
               <tr>	
           		<th><span>开始时间：</span></th>
               	<td>
 	      <input class="easyui-datetimespinner" type="text" name="startTime" value="" id="startTime" style="width:180px;" data-options="showSeconds:true">           		

	          </td>
            </tr>
               <tr>	
           		<th><span>结束时间：</span></th>
               	<td>
       <input class="easyui-datetimespinner" type="text" name="endTime" value=""  id="endTime" style="width:180px;" data-options="showSeconds:true">           		
               	 
        		</td>
            </tr>
         
            <tr>
           		<th><span>下一期间隔时间：</span></th>
               	<td>
               		<div class="wrap_input"><input class="easyui-textbox" type="text" name="nextInterval" value="" data-options="required:true" ></input>(单位：h)</div>
           		</td>
            </tr>
        </table>
    </form>
</div>
<script>

top.window.subPage.save = save;
function save() {
	if($("#ff").form('enableValidation').form('validate')) {
		$.post("add", getParam(), function(data) {
			if ("success"==data.result){
				top.window.closeWindow();
				top.window.subPage.loadCurrDatagrid();
			} else {
				showMsg(data.msg);
			}
			return ;
		});
	}
}

function getParam() {
	var param = {	     
       	    "activityPlan.goodsName": $.trim($(":input[name='goodsName']").val()), 
       	    "activityPlan.commodityprice": $.trim($(":input[name='commodityprice']").val()),      	
       	    "activityPlan.merchandise": $.trim($(":input[name='merchandise']").val()), 
       	    "activityPlan.currentinventory": $.trim($(":input[name='currentinventory']").val()),    	    
         	//"activityPlan.smallpic": $.trim($(":input[name='smallpic']").val()),
         	
       	    "activityPlan.partion": $.trim($(":input[name='partion']").val()), 
       	    "activityPlan.perpartion": $.trim($(":input[name='perpartion']").val()), 
       	    "activityPlan.competitionId": $.trim($(":input[name='competitionId']").val()), 
       	    "activityPlan.startTime": $.trim($(":input[name='startTime']").val()),
       	 	"activityPlan.endTime": $.trim($(":input[name='endTime']").val()),
       	    "activityPlan.nextInterval": $.trim($(":input[name='nextInterval']").val()),
       	 	"activityPlan.productId": $.trim($(":input[name='productId']").val()),
	};
	for(key in param) {
		if(!param[key]) {
			delete param[key];
		}
	}
	return param;
}

var mer=$("#merchandise").val();
if(mer=='0'){
	$("#merchandise").val("实物");
}else if(mer=='1'){
	$("#merchandise").val("数字商品");
}

//扩展js
   var today = new Date();
   var day = today.getDate();
   var month = today.getMonth() + 1;
   var year = today.getYear();
   var mytime=today.toLocaleTimeString();
   var date = year + "-" + month + "-" + day + " " + mytime;   
   document.getElementById("endTime").value = 123;
   document.getElementById("startTime").value = 123;
</script>

<#include "/common/foot.html"/>
